<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserRobeTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_robe', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->comment('=users.id');
            $table->integer('shop_id')->comment('=shop.id');
            $table->tinyInteger('type')->comment('0借衣1换购');
            $table->integer('shop_com_id')->comment('店铺商品ID');
            $table->integer('commodity_id')->comment('商品ID');
            $table->integer('commodity_attr_id')->comment('商品属性ID');
            $table->integer('count')->default(1)->comment('购买数量');
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `user_robe` comment '用户衣柜表';");        
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_robe');
    }
}
